package fangjxc;

import java.util.HashMap;
import java.util.Map;

import org.junit.Test;
import cn.diancan.dto.PurchaseSaleOrderStatisticsDto;
import cn.diancan.dto.query.PurchaseSaleOrderProductQuery;
import cn.diancan.model.types.PurchaseSaleOrderProductStatusType;
import cn.diancan.util.FtlUtils;
import cn.diancan.util.MailUtil;
import cn.diancan.vo.manager.PurchaseSaleManagerOrderActionVo;
import cn.diancan.vo.other.Pager;

public class OrderTest extends BaseTest {

    @Test
    public void test1() {
        try {
            String outOrderNumber = "JMHS11981479207617";
            String basePath = "http://122.228.236.84:8080/taobaoClone/";

            FtlUtils ftlUtils = new FtlUtils();
            ftlUtils.init(true);
            Map<String, Object> root = new HashMap<String, Object>();


            PurchaseSaleManagerOrderActionVo requestVo = new PurchaseSaleManagerOrderActionVo();
            Pager pager = new Pager();
            requestVo.setOutOrderNumber(outOrderNumber);

            pager.setPageNumber(requestVo.getPageNumber());
            pager.setPageSize(10);


            PurchaseSaleOrderProductQuery query = requestVo.getQuery();
            PurchaseSaleOrderStatisticsDto statisticsDto = new PurchaseSaleOrderStatisticsDto();
            pager = purchaseSaleOrderService.findPagerBySaleOrderProduct(pager, query, statisticsDto);

            root.put("purchaseSaleOrderProductStatusTypeEnum", PurchaseSaleOrderProductStatusType.getSaleValues());

            root.put("pager", pager);
            root.put("purchaseSaleOrderStatistics", statisticsDto);
            root.put("requestVo", requestVo);
            root.put("basePath", basePath);
            root.put("base", basePath);
            root.put("login_manager_Id", 1);
            //sale_order_product_list_template.ftl
            ///views/ftl/manager/purchasesaleorder/sale_order_statistics_product_list_template.ftl
            String html = ftlUtils.buildTemplate(root, "/views/ftl/manager/purchasesaleorder/sale_order_product_list_template.ftl");
            MailUtil.sendMail("订单通知", "订单通知", html);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
